<?php if(count($model->getErrors()) > 0):?>
	<div class="alert alert-danger">
		<?php echo BSHtml::errorSummary($model); ?>
	</div>
<?php endif;?>
<div class="">
<?php echo BSHtml::beginForm('', 'POST', array('autocomplete'=>'off')); ?>
	<fieldset>
		<legend><?php echo $model->isNewRecord ? 'Создание' : 'Редактирование'?> пользователя</legend>
		<p class="note">Поля, помеченные <span class="required">*</span> обязательны для заполнения.</p>

		<div class="form-group">
			<?php echo BSHtml::activeLabelEx($model,'first_name', array('class'=>'col-lg-2')); ?>
			<div class="col-lg-10">
				<?php echo BSHtml::activeTextField($model,'first_name'); ?>
			</div>
		</div>

		<div class="form-group">
			<?php echo BSHtml::activeLabelEx($model,'last_name', array('class'=>'col-lg-2')); ?>
			<div class="col-lg-10">
				<?php echo BSHtml::activeTextField($model,'last_name'); ?>
			</div>
		</div>

		<div class="form-group">
			<?php echo BSHtml::activeLabelEx($model,'email', array('class'=>'col-lg-2')); ?>
			<div class="col-lg-10">
				<?php echo BSHtml::activeTextField($model,'email'); ?>
			</div>
		</div>

		<?php if($model->getScenario() == 'insert'):?>
			<div class="form-group">
				<?php echo BSHtml::activeLabelEx($model,'password', array('class'=>'col-lg-2')); ?>
				<div class="col-lg-10">
					<?php echo BSHtml::activePasswordField($model,'password'); ?>
				</div>
			</div>

			<div class="form-group">
				<?php echo BSHtml::activeLabelEx($model,'passwordConfirm', array('class'=>'col-lg-2')); ?>
				<div class="col-lg-10">
					<?php echo BSHtml::activePasswordField($model,'passwordConfirm'); ?>
				</div>
			</div>
		<?php else:?>
			<div class="form-group">
				<?php echo BSHtml::activeLabelEx($model,'newPassword', array('class'=>'col-lg-2')); ?>
				<div class="col-lg-10">
					<?php echo BSHtml::activePasswordField($model,'newPassword'); ?>
				</div>
			</div>

			<div class="form-group">
				<?php echo BSHtml::activeLabelEx($model,'newPasswordConfirm', array('class'=>'col-lg-2')); ?>
				<div class="col-lg-10">
					<?php echo BSHtml::activePasswordField($model,'newPasswordConfirm'); ?>
				</div>
			</div>
		<?php endif;?>

		<?php if(Yii::app()->user->checkAccess("admin")): ?>
			<div class="form-group">
				<?php echo BSHtml::activeLabelEx($model,'roles', array('class'=>'col-lg-2')); ?>
				<div class="col-lg-10">
					<?php echo BSHtml::dropDownList('User[roles]', 
						CHtml::listData($model->authAssignment, 'itemname', 'itemname'),
						CHtml::listData(Yii::app()->authManager->getRoles(), 'name', 'description'), 
						array('multiple'=>'multiple', 'class'=>'form-control')); ?>
				</div>
			</div>
		<?php endif;?>
		<div class="form-group">
			<div class="col-lg-10 col-lg-offset-2 align-right">
				<?php echo BSHtml::submitButton($model->isNewRecord ? 'Создать' : 'Изменить'); ?>
			</div>
		</div>
	</fieldset>
<?php echo BSHtml::endForm(); ?>
</div>